package com.neiquan.backstage.common.util;

public class SimpleErrorCode implements ErrorCode {
	private int code;
	private String errorMessage;

	public SimpleErrorCode(int code, String errorMessage) {
		this.code = code;
		this.errorMessage = errorMessage;
	}

	public void setCode(int code) {
		this.code = code;
	}

	@Override
	public int getCode() {
		return code;
	}

	public void setErrorMessage(String errorMessage) {
		this.errorMessage = errorMessage;
	}

	@Override
	public String getErrorMessage() {
		return errorMessage;
	}

	public static ErrorCode build(int code, String errorMessage) {
		return new SimpleErrorCode(code, errorMessage);
	}

	public static ErrorCode buildError(String errorMessage) {
		return new SimpleErrorCode(ErrorCode.code_error, errorMessage);
	}
}
